package day5;

/**
 * @author oldliu
 * @since 1.0
 */
public class Employee implements Comparable<Employee>{
    private String id;//定义工号
    private String name;
    private int age;
    private String sex;
    private String position;
    private double salary;

    public Employee(String id, String name, int age, String sex, String position, double salary) {
        this.id = id;
        this.name = name;
        this.age = age;
        this.sex = sex;
        this.position = position;
        this.salary = salary;
    }

    public Employee() {

    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getPosition() {
        return position;
    }

    public void setPosition(String position) {
        this.position = position;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    //对象，obj.comparetTo(o）
    @Override
    public int compareTo(Employee o) {
        return this.name.compareTo(o.name);
       // return (int) (this.getSalary()-o.salary);
    }

    @Override
    public String toString() {
        return this.name+","+this.salary;
    }
}